home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume91
/
utilitys
/
ed3_1_1
/
part01
/
ed3.h
< prev
next >
Wrap
C/C++ Source or Header
|
1991-11-07
|
7KB
|
224 lines
/*
Include file for all modules of the 3d editor.
Important global stuff.
09-02-91 added pselected, ploose
08-28-91 added MAX_EDGES
08-24-91 moved Gadget IDs to edgr.c
08-23-91 moved Menu IDs to sysgr.c
moved many flags into a new "Flags" structure
*/
#define INTEGER 1
#define MAX_EDGES 20 /* The most edges any polygon is allowed to have */
#define OPERATIONS 100 /* max */
#define ACTIONBUF 300 /* action buffer size */
#define REFRESH_LEVEL 100 /* If there are less then REFRESH_LEVEL facets on
the screen, undo, redo and and move_points will do a full refresh to keep the
display clean. Obviously we don't ALWAYS want to do a full refresh if the
object has many hundreds of facets */
#include "sysdefed.h" /* system-specific definitions */
#include "edtypes.h" /* typedefs */
#if PROTOS
#include "create.p" /* include prototypes */
#include "edgr.p"
#include "eded.p"
#include "sysgr.p"
#include "edio.p"
#include "edvan.p"
#include "freq.p"
#include "undo.p"
#endif
#define FILE_EXT ".3d"
#define GADX 90 /* width of gadget boxes */
#define edit_minx GADX+1 /* bounds of editing area */
/* edit_miny is a variable based on the size of the title bar */
/* gadget IDs */
#define GID_ADD 1
#define GID_DELETE 2
#define GID_SELECTOR 3
#define GID_MOVE 4
#define GID_FACE 5
#define GID_POLY 6
#define GID_MORE 7
#define GID_DEFACE 8
#define GID_DEPOLY 9
#define GID_MORE2 10
#define GID_ROTATE 11
#define GID_ROTP 12
#define GID_ZOOM 13
#define GID_DIST 14
#define GID_GLUE 15
#define GID_UNDO 16
#define GID_REDO 17
#define GID_XY 18
#define GID_XZ 19
#define GID_ZY 20
#define GID_3D 21
#define GID_color1 22
#define GID_color2 23
#define GID_color3 24
/* editing modes */
#define M_ADDP 0 /* add point */
#define M_DELP 1 /* delete point */
#define M_SELE 2 /* select/deselect points */
#define M_MOVP 3 /* move point */
#define M_FACE 4 /* start a new face */
#define M_POLY 5 /* start a new face */
#define M_MORE 6 /* designate another point of the face or poly to create */
#define M_DEFA 7 /* remove a face */
#define M_DEPO 8 /* remove a poly */
#define M_KMORE 9 /* designate another point of the face or poly to remove */
#define M_ROTA 10 /* rotate around third dimension: place axis */
#define M_ROTP 11 /* rotate around third dimension: move the points */
#define M_ZOOM 12 /* zoom in/out */
#define M_DIST 13 /* adjust distance tool */
#define M_GLUE 14 /* glue two points together (fuse into one point) */
/* display modes */
#define DM_XY 0 /* three 2D display modes */
#define DM_XZ 1
#define DM_ZY 2
#define DM_3D 3 /* 3D view mode, unimplemented */
/* Toggleable menu item numbers */
#define MI_ASSUME_POLY 0
#define MI_COORDS 1
#define MI_CROSSHAIR 2
#define MI_DISTANCETOOL 3
#define MI_ROTATEALL 4
#define MI_UNDOBUF 5
#define MI_UNDOBUFSIZE 6
/* error codes */
#define OKAY 0
#define ERR_NOTHING 1 /* nothing was there */
#define ERR_CANTOPEN 2 /* can't open a file */
#define ERR_NOTED3 3 /* not an ED3 file */
#define ERR_NOMEM 4 /* not enough memory for operation */
#define ERR_NOMEM_POINT 5 /* not enough memory for more points */
#define ERR_NOMEM_FACE 6 /* not enough memory for more faces */
#define ERR_NOMEM_POLY 7 /* not enough memory for more polygons */
#define ERR_BADFACE 8 /* face refers to a non-existent point */
#define ERR_SYS 9
#define ERRORS 10
/* Menu options */
#define MO_NOTENABLED 1
#define MO_TOGGLE 2 /* allow user to toggle w/checkmark */
#define MO_CHECKED 4 /* checked at creation time */
/* Gadget flags */
#define GF_NOSELECT 1 /* this gadget should not be selectable */
/* display flags */
#define DF_WORKBENCH 1
#define DF_MED_RES 2
#define DF_SYS_PALETTE 4 /* use the system (in this case workbench) palette */
/* mouse flags */
#define MF_DOUBLE 2
#define MF_SHIFTED 4
/* action types */
#define AT_ADD_P 1 /* add point */
#define AT_DEL_P 2 /* del point */
#define AT_ADD_F 3 /* add face */
#define AT_DEL_F 4 /* del face */
#define AT_ADD_Q 5 /* add polygon */
#define AT_DEL_Q 6 /* del polygon */
#define AT_MOVE_P 7 /* move point */
#define AT_JOIN_P 8 /* join two points (replace one with another) */
#define AT_DEL_V 9 /* delete vertex */
#define AT_MORPH_Q 10 /* degenerate a polygon into a face */
/* polyhedron numbers */
#define POLY_TET 0
#define POLY_OCT 1
#define POLY_CUBE 2
#define POLY_ICOS 3
#define POLY_DODEC 4
#define POLY_RHOMB 5
#define POLY_CUBOCT 6
/* point flags: in the code field of EdPoint (below) */
#define PF_LOOSE (1 << 14)
#define PF_SELECTED (1 << 15)
#define PF_CLIP 0x000f /* low four bits used for clipping info */
#define EV_HITBUTTON 1 /* pressed a boolean gadget */
#define EV_HITRETURN 2 /* hit return in a long_int gadget */
#define EV_CHECKINT 3
#define EV_CANCEL 4 /* like, if the user closes the window */
/* point macros */
#define pselected(p) (point[p].code & PF_SELECTED)
#define ploose(p) (point[p].code & PF_LOOSE)
#define off_screen(p) (point[p].code & PF_CLIP)
/* an unused value returned by ShowGetLong to signal cancellation */
#define SGL_CANCEL -69696969 /* orgy */
#ifdef DEFINE_GLOBALS
# define vextern
#else
# define vextern extern
#endif
/******* global variables *******/
/* pointers to the complete set of 3D points and faces */
vextern EdPoint *point;
vextern Face *face;
vextern Polygon *poly;
vextern EndPoint dtool_end[2]; /* the ends of the distance tool line segment */
vextern Flags flags;
vextern Colors colors;
vextern short *select_p; /* array of selected points */
/* temporary: remember the points when creating a new polygon */
vextern unsigned short temp_poly[20];
vextern unsigned short MAX_POINTS, MAX_FACES, MAX_SELECT, MAX_POLYS;
vextern unsigned short points, faces, polys, selected;
vextern unsigned short new_seg, first_point, last_point;
vextern Point3D axis; /* point around which we rotate */
vextern Point3D point0; /* always 0 */
vextern Vector3D movement; /* the direction we drag the points */
vextern Vector3D offset; /* current viewing offset */
vextern Vector3D vector0; /* always 0 */
/* Please Forgive Me for Using Short Names for some Global Variables */
vextern coord gx, gy, gz; /* global 3d cursor location */
vextern short px, py,
mx, my; /* mouse location on screen */
vextern char mode, /* editing mode */
dmode; /* display mode (XZ etc.)play mode (XZ etc. */
vextern short sxmax, symax; /* flexible size of drawing area */
vextern short x_center, y_center;
vextern short edit_miny;
vextern double rot_angle;
vextern double SCALE, distance;
vextern char title[80]; /* the message on the screen's title bar*/
extern char *errstring[];
vextern action_bufsize, act_buf; /* in-use vs. next time */
vextern operation_bufsize, op_buf;
vextern Operation *operation;
vextern char *action;
vextern changes; /* number of operations given since last save */